using System;
using UnityEngine;

public class EnergyControlConfig : ScriptableObject
{
	private static EnergyControlConfig instance_;

	public float maxEnergy = 50f;

	public int secondsToRefreshPoint = 30;

	public static EnergyControlConfig instance
	{
		get
		{
			if (instance_ == null)
			{
				instance_ = Resources.Load("EnergyControlConfig", typeof(EnergyControlConfig)) as EnergyControlConfig;
			}
			return instance_;
		}
	}

	public int EnergyRefillPrice()
	{
		return CoinsForTime(new TimeSpan(0, 0, (int)((float)secondsToRefreshPoint * maxEnergy * 0.7f)));
	}

	public int CoinsForTime(TimeSpan time)
	{
		float num = 70f;
		return Mathf.Max(1, Mathf.RoundToInt((float)(time.TotalHours * (double)num)));
	}

	public float GetEnergyForTimespan(TimeSpan timeSpan)
	{
		return (float)timeSpan.TotalSeconds / (float)secondsToRefreshPoint;
	}

	public TimeSpan TimeToGainEnergy(float energyGain)
	{
		return new TimeSpan(0, 0, (int)energyGain * secondsToRefreshPoint);
	}
}
